package com.yu.crm.service.impl;

import com.yu.crm.domain.pojo.CrmAskLeave;
import com.yu.crm.mapper.CrmAskLeaveMapper;
import com.yu.crm.service.ICrmAskLeaveService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxzz.common.config.UserCacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * <p>
 * 请假表 服务实现类
 * </p>
 *
 * @author neo
 * @since 2020-07-21
 */
@Service
public class CrmAskLeaveService extends ServiceImpl<CrmAskLeaveMapper, CrmAskLeave> implements ICrmAskLeaveService {
    @Autowired
    UserCacheManager userCacheManager;

    /**
     * 请假申请
     * @param leave
     */
    @Override
    public void askForLeave(@RequestBody CrmAskLeave leave) {
        //获取当前申请人id
        String userid = userCacheManager.getCurrentUser().getUserId();
        //TODO 节点信息  工作流引入
        leave.setStatusEnumId(2);
        //TODO 记录流水表
        baseMapper.insert(leave);
    }
}
